package com.dong.minio.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultEntity<T> {
    private Integer code;
 
    private String message;
 
    private T data;
 
    public static <T> ResultEntity<T>  faill(Integer code, String msg, T t) {
        return new ResultEntity<T>(code, msg, t);
    }
 
    public static <T> ResultEntity<T> faill(T t) {
        return ResultEntity.faill(501, "failed", t);
    }
 
    public static <T> ResultEntity<T> success(Integer code, String msg, T t) {
        return new ResultEntity<T>(code, msg, t);
    }
 
    public static <T> ResultEntity<T> success(T t) {
        return ResultEntity.success(200, "success!", t);
    }
 
    public static <T> ResultEntity<T> success() {
        return ResultEntity.success(200, "success!", null);
    }
}